package com.volatileshooter.state.command.commands;

import com.volatileshooter.state.command.Command;
import com.volatileshooter.state.command.CommandParser;

/**
 * Help command - list all available commands.
 * @author void
 */
public class Help implements Command {

	/**
	 * commandParser.
	 */
	private CommandParser commandParser;

	/**
	 * constructor.
	 * @param commands commandParser
	 */
	public Help(final CommandParser commands) {
		commandParser = commands;
	}

	/**
	 * execute.
	 * @param args arguments.
	 */
	public String execute(final String[] args) {
		StringBuffer buffer = new StringBuffer();
		buffer.append("available commands:\n");
		for (String command : commandParser.getCommands()) {
			buffer.append(command + "\n");
		}
		return buffer.toString();
	}

}
